<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="title">
        Charts <span class="subitem">Bar</span>
    </ui:define>

    <ui:define name="description">
        BarChart is created with raw JSON or using an <a href="https://github.com/xdev-software/chartjs-java-model" target="_blank" rel="noopener noreferrer">XDEV</a> model. When a dataset data is clicked, information can be passed to a backing bean using itemSelect ajax behavior. 
    </ui:define>

    <ui:param name="documentationLink" value="/components/chart"/>
    <ui:param name="widgetLink" value="Chart"/>

    <ui:define name="implementation">
        <h:form>
            <p:growl id="growl" showDetail="true"/>

            <div class="card">
                <h5>Bar</h5>
                <p:chart value="#{chartView.barModel}" style="width: 100%; height: 500px;">
                    <p:ajax event="itemSelect" listener="#{chartView.itemSelect}" update="growl"/>
                </p:chart>
            </div>
            
            <div class="card">
                <h5>Stacked</h5>
                <p:chart value="#{chartView.stackedBarModel}" style="width: 100%; height: 500px;">
                    <p:ajax event="itemSelect" listener="#{chartView.itemSelect}" update="growl"/>
                </p:chart>
            </div>

        </h:form>
    </ui:define>

</ui:composition>
